﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Free2AskModel;
namespace Free2AskWeb.Controllers
{
    [Authorize]
    public class AdminController : Controller
    {
        //
        // GET: /Admin/

        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public ActionResult ImportACL()
        {
            return View();
        }

        public ActionResult ControlPanel()
        {
            return View();
        }

        public ActionResult CleanTags()
        {
            Free2AskDBEntities db = new Free2AskDBEntities();
            (from t in db.Tags
                        where t.Posts.Count == 0
                        select t).ToList().ForEach(t => db.DeleteObject(t));
            db.SaveChanges();
            return RedirectToAction("ControlPanel");
        }
    }
}
